<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta charset="UTF-8">
		<title>AA拼车</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" href="${ctxStatic }/car/css/mui.min.css" />
		<link rel="stylesheet" href="${ctxStatic }/car/css/aa_cars.css" />
		<script src="${ctxStatic }/jquery/jquery-1.8.3.min.js"></script>
		<style>
			#weixin-tip {
				display: none;
				position: fixed;
				left: 0;
				top: 0;
				background: rgba(0, 0, 0, 0.8);
				filter: alpha(opacity=80);
				width: 100%;
				height: 100%;
				z-index: 100;
			}
			
			#weixin-tip p {
				text-align: center;
				margin-top: 10%;
				padding: 0 5%;
				position: relative;
			}
			
			#weixin-tip p img {
				max-width: 100%;
				height: auto;
			}
			
			#weixin-tip .close {
				color: #fff;
				padding: 5px;
				font: bold 20px/24px simsun;
				text-shadow: 0 1px 0 #ddd;
				position: absolute;
				top: 0;
				left: 5%;
			}
		</style>
		<script type="text/javascript">
		
		//微信遮罩
		var is_weixin = (function() {
				return navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1
			})();
			window.onload = function() {
				var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight; //兼容IOS，不需要的可以去掉
				var btn = document.getElementById('J_weixin');
				var tip = document.getElementById('weixin-tip');
				var close = document.getElementById('close');
				if(is_weixin) {
						tip.style.height = winHeight + 'px'; //兼容IOS弹窗整屏
						tip.style.display = 'block';
						return false;
				}
			}
		
			$(function(){
				$('#close').click(function(){
					$('#weixin-tip').hide();
				})
			})
		
		function getQueryString(userid) {   
            var reg = new RegExp("(^|&)" + userid + "=([^&]*)(&|$)", "i");  
            var l = decodeURI(window.location.search);  
            var r = l.substr(1).match(reg);  
            if (r != null) return unescape(r[2]);  
            return null;  
        } 
		
		$(document).ready(function(){ 
			var browser = {
         			versions: function () {
         			 var u = navigator.userAgent, app = navigator.appVersion;
         			 return {   //移动终端浏览器版本信息
        				   trident: u.indexOf('Trident') > -1, //IE内核
        				   presto: u.indexOf('Presto') > -1, //opera内核
        				   webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
        				   gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
        				   mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
        				   ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
        				   android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器
        				   iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
        				   iPad: u.indexOf('iPad') > -1, //是否iPad
        				   webApp: u.indexOf('Safari') == -1 //是否web应该程序，没有头部与底部
        			  };
         			}(),
         			language: (navigator.browserLanguage || navigator.language).toLowerCase()
        		}
			if (browser.versions.mobile) {//判断是否是移动设备打开。browser代码在下面
              	var ua = navigator.userAgent.toLowerCase();//获取判断用的对象
              
             	 if (browser.versions.ios&&getQueryString("fromapp")!=null&&getQueryString("fromapp") == "ios") {
                //是否在IOS浏览器打开
                	showShare("新玩法.AA拼车去旅行","我在霞客约车发现一个新功能－AA拼车，快来认识新朋友，一起去野。","https://www.xiakeyueche.com/userfiles/share.png"); 
                	return;
          	    } 
             	 if(browser.versions.android&&getQueryString("fromapp")!=null&&getQueryString("fromapp") == "android"){
             		 window.android.showShare("新玩法.AA拼车去旅行","我在霞客约车发现一个新功能－AA拼车，快来认识新朋友，一起去野。","https://www.xiakeyueche.com/userfiles/share.png");
             		return;
            	  } 
            	}
			
		}); 
		
		function openclient1() {
	    	var ua = navigator.userAgent.toLowerCase();
            var t;
            var config = {
                /*scheme:必须*/
               	scheme: 'xiakeyueche://activity?type=lvyou',
                download_url: "http://www.xiakeyueche.com/download.jsp",
                timeout: 3000
            };
           var startTime = Date.now();
           var ifr = document.createElement('iframe');
				
           if(ua.indexOf('os') > 0){
               window.location.href="xiakeyueche://activity?type=lvyou";
           }else{
          	 ifr.src = config.scheme ;
          	 ifr.style.display = 'none';
               document.body.appendChild(ifr);
           }
           
           var t = setTimeout(function() {
               var endTime = Date.now();
               if (!startTime || endTime - startTime < config.timeout + 200) {
                   window.location = config.download_url;
               } else {
                   
               }
           }, config.timeout);

           window.onblur = function() {
               clearTimeout(t);
           }
       }
		
		function openclient2() {
	    	var ua = navigator.userAgent.toLowerCase();
            var t;
            var config = {
                /*scheme:必须*/
                scheme: 'xiakeyueche://activity?type=aacar',
                download_url: "http://www.xiakeyueche.com/download.jsp",
                timeout: 1500
            };
           var startTime = Date.now();
           var ifr = document.createElement('iframe');
				
           if(ua.indexOf('os') > 0){
        	   
               window.location.href="xiakeyueche://activity?type=aacar";
           }else{
          	 ifr.src = config.scheme ;
          	 ifr.style.display = 'none';
               document.body.appendChild(ifr);
           }
           
           var t = setTimeout(function() {
               var endTime = Date.now();
               if (!startTime || endTime - startTime < config.timeout + 200) {
                   window.location = config.download_url;
               } else {
                   
               }
           }, config.timeout);

           window.onblur = function() {
               clearTimeout(t);
           }
       }
		
		$(function(){
			$("#go1").click(function(){
				if(getQueryString("fromapp")!=null&&getQueryString("fromapp").length>1){
					if(getQueryString("fromapp")=="android"){
						window.android.goTravel();
					}else{
						goTravel();
					}
				}else{
					openclient1();
				}
			})
			
			$("#go2").click(function(){
				if(getQueryString("fromapp")!=null&&getQueryString("fromapp").length>1){
					if(getQueryString("fromapp")=="android"){
						 window.android.goAACar();
					}else{
						goAACar();
					}
				}else{
					openclient2();
				}

			})
			
		});
		
		</script>
	</head>
	<body>
	<div id="weixin-tip">
		<p>
			<img src="${ctxStatic }/car/img/zhezhao.png" alt="微信打开" />
			<span id="close" title="关闭" class="close">×</span>
		</p>
	</div>
		<div id="AA_cars">
			<div class="mui-content">
				<div class="aa_car_wrap">
					<div class="aa_cars_im">
						<img src="${ctxStatic }/car/img/aacars1.jpg" />
					</div>
					<div class="aa_cars_im aa_cars_box" style="margin-top: 26px;">
						<img src="${ctxStatic }/car/img/aa_cars1.png" />
						<a href="javascript:void(0)" class="aa_cars_btn" id="go1">
					         <img src="${ctxStatic }/car/img/aacars_btna.png" />
						</a>
					</div>
					<div class="aa_cars_im aa_cars_box" style="margin-top: 78px;">
						<img src="${ctxStatic }/car/img/aa_cars2.png" />
					</div>
					<div class="aa_cars_im aa_cars_box">
						<a href="javascript:void(0)" class="aacars_btn2" id="go2">
					        <img src="${ctxStatic }/car/img/aa_cars_btn.png" />
						</a>
					</div>
				</div>
			</div>
		</div>
		<script src="${ctxStatic }/yanchengh/js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init()
		</script>
	</body>

</html>